package com.inexas.cu.server.core;

import javax.jdo.annotations.*;
import com.inexas.cu.stratus.*;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Account implements Entity {
	private static final long serialVersionUID = 282970399007219853L;
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long ident;
	private Long personIdent;
	@SuppressWarnings("unused")
	private String name, password;

	@SuppressWarnings("unused")
	private Account() {
		// Serialization
	}

	public Account(Person person, String name, String password) {
		assert person != null && person.getIdent() != null : "Create person first please!";
		this.personIdent = person.getIdent();
		this.name = name;
		this.password = password;
	}

	public Long getIdent() {
		return ident;
	}

	public String getName() {
		return name;
	}

	public Long getPersonIdent() {
		return personIdent;
	}

}
